package com.manage.project.biz.controller;

import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.manage.framework.aspectj.lang.annotation.Log;
import com.manage.framework.aspectj.lang.enums.BusinessType;
import com.manage.project.biz.domain.BizQitasheshishebei;
import com.manage.project.biz.service.IBizQitasheshishebeiService;
import com.manage.framework.web.controller.BaseController;
import com.manage.framework.web.domain.AjaxResult;
import com.manage.common.utils.poi.ExcelUtil;
import com.manage.framework.web.page.TableDataInfo;

/**
 * 设备管理Controller
 *
 * @author ruoyi
 * @date 2022-05-30
 */
@RestController
@RequestMapping("/biz/qitasheshishebei")
public class BizQitasheshishebeiController extends BaseController
{
    @Autowired
    private IBizQitasheshishebeiService bizQitasheshishebeiService;

    /**
     * 查询设备管理列表
     */
    @PreAuthorize("@ss.hasPermi('biz:qitasheshishebei:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizQitasheshishebei bizQitasheshishebei)
    {
        startPage();
        List<BizQitasheshishebei> list = bizQitasheshishebeiService.selectBizQitasheshishebeiList(bizQitasheshishebei);
        return getDataTable(list);
    }

    /**
     * 导出设备管理列表
     */
    @PreAuthorize("@ss.hasPermi('biz:qitasheshishebei:export')")
    @Log(title = "设备管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizQitasheshishebei bizQitasheshishebei) throws IOException {
        List<BizQitasheshishebei> list = bizQitasheshishebeiService.selectBizQitasheshishebeiList(bizQitasheshishebei);
        ExcelUtil<BizQitasheshishebei> util = new ExcelUtil<BizQitasheshishebei>(BizQitasheshishebei.class);
        util.exportExcel(response, list, "设备管理数据");
    }

    /**
     * 获取设备管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('biz:qitasheshishebei:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(bizQitasheshishebeiService.selectBizQitasheshishebeiById(id));
    }

    /**
     * 新增设备管理
     */
    @PreAuthorize("@ss.hasPermi('biz:qitasheshishebei:add')")
    @Log(title = "设备管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizQitasheshishebei bizQitasheshishebei)
    {
        return toAjax(bizQitasheshishebeiService.insertBizQitasheshishebei(bizQitasheshishebei));
    }

    /**
     * 修改设备管理
     */
    @PreAuthorize("@ss.hasPermi('biz:qitasheshishebei:edit')")
    @Log(title = "设备管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizQitasheshishebei bizQitasheshishebei)
    {
        return toAjax(bizQitasheshishebeiService.updateBizQitasheshishebei(bizQitasheshishebei));
    }

    /**
     * 删除设备管理
     */
    @PreAuthorize("@ss.hasPermi('biz:qitasheshishebei:remove')")
    @Log(title = "设备管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bizQitasheshishebeiService.deleteBizQitasheshishebeiByIds(ids));
    }
}
